#include<iostream>
#include<vector>
using namespace std;
    
int MoreThanHalfNum_Solution(vector<int>& numbers) {
        // write code here
        int n = 0;
        for (int i = 0; i < numbers.size(); i++)
        {
            int num = 0, times = 0;

            num = numbers[i];
            times++;
            for (int j = i + 1; j < numbers.size(); j++)
            {
                if (num == numbers[j])
                    times++;
            }

            if (times > numbers.size() / 2)
            {
                n = num;
                break;
            }
        }
        return n;
    }
int main()
{
    vector<int> numbers{ 1,2,3,2,2,2,5,4,2 };
    int i=MoreThanHalfNum_Solution(numbers);
    cout << i << endl;
    return 0;
 }